/* GUI CONVERTED from remkcr.p (converter v1.75) Sat Aug 12 23:06:14 2000 */
/* remkcr.p - CREATE/DELETE MARKER RECORD FOR REPETETIVE LABOR TRANSACTION    */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/*V8:ConvertMode=Maintenance                                                  */
/*K1Q4*/ /*V8:WebEnabled=No                                                   */
/* REVISION: 7.3       CREATED BY: 09/16/97    BY: *G2P5* Manmohan Pardesi    */
/* REVISION: 8.6    LAST MODIFIED: 05/20/98 BY: *K1Q4* Alfred Tan             */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00 BY: *N0KP* myb                    */


/* I/O     NAME         TYPE         DESCRIPTION                              */
/* -----   ----------   ---------    -----------------------------------      */
/* input   wolot        character    WO ID                                    */
/* input   do_what      integer      Create/Modify/Delete Marker Records      */
/* input   uid          character    mfguser                                  */
/* input   global_uid   character    global_userid                            */
/*                                                                            */
/* do_what = 1   (Create/Update Marker Record)                                */
/* do_what = 2   (Delete Marker Record)                                       */

         define input parameter wolot like wo_lot no-undo.
         define input parameter do_what as integer no-undo.
         define input parameter uid as character no-undo.
         define input parameter global_uid as character no-undo.

         do transaction :
            find qad_wkfl exclusive-lock
            where qad_key1 = "labor_tran"
            and qad_key2 = string(wolot, "x(8)") + string(uid, "x(8)")
            no-error.
            if available qad_wkfl then do:
               /* UPDATE TIME AND DATE STAMP */
               if do_what = 1 then do:
                  assign qad_datefld[1] = today
                         qad_charfld[2] = string(time, "hh:mm:ss").
               end. /* IF DO_WHAT = 1 */
               /*DELETE MARKER RECORD*/
               else if do_what = 2 then do:
                  delete qad_wkfl.
               end. /* IF DO_WHAT = 2 */
            end. /* IF AVAILABLE QAD_WKFL */
            else do:
               /* CREATE MARKER RECORD */
               if do_what = 1 then do:
                  create qad_wkfl.
                  assign qad_key1 = "labor_tran"
                         qad_key2 = string(wolot, "x(8)" )
                            + string(uid, "x(8)")
                         qad_key3 = "labor_tran"
                         qad_key4 = wolot
                         qad_key5 = "labor_tran"
                         qad_key6 = global_uid
                         qad_charfld[1] = uid
                         qad_charfld[2] = string(time,"hh:mm:ss")
                         qad_datefld[1] = today.
                  if recid(qad_wkfl) = -1 then .
               end. /* IF DO_WHAT = 1 */
            end. /* IF NOT AVAILABLE QAD_WKFL */
         end. /* DO TRANSACTION */
